home *** CD-ROM | disk | FTP | other *** search
/ PC User 2001 August / APC_Aug2001_CD2.iso / features / web_dev / files / mwjpp516.exe / %MAINDIR% / Tools / Code folding / toggleFold.script < prev    next >
Encoding:
Text File  |  2001-06-19  |  713 b   |  36 lines

  1. !!Script
  2. // Copyright ⌐ 1999 - Modelworks Software
  3. // @Create build 260 cm19990128
  4.  
  5. /**
  6. @Tool: toggleFold~shows or hides child lines. 
  7. @EndTool: 
  8. @Summary: toggleFold~shows or hides child lines
  9. */
  10.  
  11. function DoCommand()
  12. {
  13.     var editor = getActiveEditor();
  14.     if (editor)
  15.     {
  16.         var lines = editor.getLines();
  17.         var selection = editor.GetSelection();
  18.         var childIndex = lines.getFirstChildLineIndex(selection.startLineIndex); 
  19.         if (childIndex != -1)
  20.         {
  21.             if (lines.childrenVisible(selection.startLineIndex))
  22.             {
  23.                 lines.foldLine(selection.startLineIndex);
  24.             }
  25.             else
  26.             {
  27.                 lines.unfoldLine(selection.startLineIndex);
  28.             }
  29.         }
  30.         lines.update("Toggle fold");
  31.     }
  32. }
  33.  
  34. !!/Script
  35.  
  36.